﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WatiN.Core;
using WatiN.Core.Constraints;
using WatiN.Core.Native.Windows;

namespace WebAutomation.Browsers
{
    public abstract class WebBrowserObject
    {
        public struct ElementProperties
        {
            public object Element { get; set; }
            public bool Exists { get; set; }
            public string ElementType { get; set; }
            public string ElementHTMLType { get; set; }
            public Dictionary<string, string> ElementAttributes { get; set; } 
        }

        public virtual object GetWebBrowserObject()
        {

            return null;
        }

        public abstract int ProcessID { get; }
        public abstract ElementProperties Button(Constraint find);
        public abstract void ButtonWaitUntilExists(Constraint find);
        public abstract void DivWaitUntilAttributeValue(string divID, string attributeName, string expectedValue);
        public abstract void WaitForComplete();
        public abstract ElementProperties CheckBox(Constraint find);
        public abstract object Div(Constraint find);
        public abstract object DomContainer();
        public abstract void CaptureWebPageAsImage(string imageFileName, string imageQualityString,int imageQuality);
        public abstract ElementProperties Element(Constraint find);
        public abstract ElementProperties Element();
        public abstract Dictionary<int, object> Frames();
        public abstract void WaitForCompleteIFrame(int iframeIndex, int secondsToWait);
        public abstract ElementProperties ElementIFrame(int iframeIndex, string idOrNameOrClassOrValue);
        public abstract void GoTo(string url);
        public abstract string Html();
        public abstract string HtmlIFrame(int iframeIndex);
        public abstract ElementProperties Link(string attributeValue);
        public abstract Dictionary<int, object> FrameLinks(int iframeIndex);
        public abstract string GetIFrameLinkAttributeValue(int iframeIndex, int linkIndex, string attributeName);
        public abstract string GetIFrameLinkClassName(int iframeIndex, int linkIndex);
        public abstract void RunScript(string scriptToRun);
        public abstract ElementProperties SelectList(Constraint find);
        public abstract void CheckBoxCheck(object checkBox, string valueOrId);
        public abstract void ElementClick(object element);
        public abstract bool SelectListSelect(object element, string selectListValue);
        public abstract void ShowWindow(NativeMethods.WindowShowStyle windowShowStyle);
        public abstract ElementProperties TextField(Constraint find);
        public abstract ElementProperties TextFieldIFrame(int iframeIndex, Constraint find);
        public abstract void TypeText(object textField, string textValueToType,WebBrowserObject webBrowserObject);
        public abstract ElementProperties ButtonIFrame(int iframeIndex, Constraint find);
        public abstract void ButtonClick(object buttonField);
        public abstract void ButtonMouseDown(object buttonField);
        public abstract void ButtonMouseUp(object buttonField);
        public abstract string GetLinkAttributeValue(object link, string attributeToGet);
        public abstract void LinkClick(object link);
        public abstract Dictionary<int, ElementProperties> Elements();
        public abstract string GetIFrameAttributeValue(int iframeIndex, string attributeName);
        public abstract bool ElementExist(object element);
        public abstract ElementProperties RadioButton(Constraint find);
        public abstract void RadioButtonCheck(object radioButton, string valueOrId);
        public abstract bool Dispose();
        public abstract ElementProperties GetLinkByText(string text, int index);
        public abstract void WinFormType(int winHandle, string textBoxId, string textToType);
        public abstract void KeyPressEnter(object textField, string keyName, WebBrowserObject browserObject);
        public abstract void Refresh(string keys);

    }
}
